using UnityEngine;
using UnityEngine.UI;

public class ShapeImage : Image
{

    public float offset;

    public float leftTopOffsetRate = 1;
    public float rightTopOffsetRate = 1;
    public float leftBottomOffsetRate = 1;
    public float rightBottomOffsetRate = 1;

    protected override void OnPopulateMesh(VertexHelper toFill)
    {
        base.OnPopulateMesh(toFill);

        UIVertex vertex = new UIVertex();
        toFill.PopulateUIVertex(ref vertex, 0);
        vertex.position += Vector3.right * offset * leftBottomOffsetRate;
        toFill.SetUIVertex(vertex, 0);

        vertex = new UIVertex();
        toFill.PopulateUIVertex(ref vertex, 1);
        vertex.position += Vector3.right * offset * leftTopOffsetRate;
        toFill.SetUIVertex(vertex, 1);

        vertex = new UIVertex();
        toFill.PopulateUIVertex(ref vertex, 2);
        vertex.position += Vector3.right * offset * rightTopOffsetRate;
        toFill.SetUIVertex(vertex, 2);

        vertex = new UIVertex();
        toFill.PopulateUIVertex(ref vertex, 3);
        vertex.position += Vector3.right * offset * rightBottomOffsetRate;
        toFill.SetUIVertex(vertex, 3);
    }
}
